home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / mxcode / sbprocss / process.c < prev    next >
C/C++ Source or Header  |  1995-01-14  |  663b  |  37 lines

  1. #include <conio.h>
  2. #include "sbsample.c"
  3.  
  4. void clipsample(signed int *sample)
  5.   {
  6.     if (*sample > 127)  *sample = 127;
  7.     if (*sample < -128) *sample = -128;
  8.   }
  9.  
  10. void processsample(signed char *sample)
  11.   {
  12.     signed int temp;
  13.  
  14.     temp = *sample - 128;
  15.  
  16.     /* Process sample here */
  17.     temp = temp; /* Very complex processing algorithm ;) */
  18.  
  19.     clipsample(&temp);
  20.     *sample = temp + 128;
  21.   }
  22.  
  23. int main(void)
  24.   {
  25.     unsigned char sample;
  26.  
  27.     resetdsp();
  28.     while (!kbhit())
  29.       {
  30.         sample = getsample();
  31.         processsample(&sample);
  32.         outputsample(sample);
  33.       }
  34.     getch();
  35.  
  36.     return(0);
  37.   }